/*
 * LiveDataTransmit.h
 *
 *  Created on: Mar 29, 2013
 *      Author: root
 */

#ifndef LIVEDATATRANSMIT_H_
#define LIVEDATATRANSMIT_H_

#include "LiveStream.h"
#include "DataStream.h"
#include "Svr_log.h"

/*data stream status*/
enum Stream_Server_Type{SVR_NODE,CENTER_CAPTURE};

/**
 * LiveDataTransmit class
 */
class LiveDataTransmit:public LiveStream,public DataStream
{
public:
	LiveDataTransmit();
	virtual ~LiveDataTransmit();

	/*
	*set stream svr type
	*/
	void set_stream_svr_type(int stype);

	/*
	*init data stream
	*/
	int init(uint16_t max_stream_count,int is_make_m3u8_list_flag,Svr_log * plog ,bool isclip= false,const char * cliproot = NULL);

protected:
	/*
	*packet chunk
	*/
	bool stream_init_chunk(uint16_t streamid,uint8_t fmt,uint8_t * pArgData,size_t len);
	bool stream_packet_chunk(uint16_t streamid,uint8_t * pSrcData,size_t len);
	bool stream_close_chunk(uint16_t streamid);
	int  stream_log(int nloglvl,const char * lpszFormat, ...);
	/*
	*packet stream
	*/
	bool chunk_init_stream(uint16_t stream_id,uint8_t fmt);
	bool chunk_write_stream(uint16_t stream_id,char * buf,u_long len);
	bool chunk_close_stream(uint16_t stream_id);
	int  chunk_log(int nloglvl,const char * lpszFormat, ...);
private:
	/*
	*type:
	*/
	Stream_Server_Type SSType;

	/*
	*log:
	*/
	Svr_log * pslog;
};

#endif /* LIVEDATATRANSMIT_H_ */
